package com.penghk.earth.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * AOP
 *
 *
 *
 */
@Component
@Aspect
public class DemoAop {

    @Pointcut("execution(* com.penghk.earth.Service.AppService.testAop(..))")
    private void aspMethod(){}

    @Pointcut("execution(* com.penghk.earth.Service.AppService.testAop(java.lang.String,java.lang.String))&&args(str1,str2)")
    private void aspMethod1(String str1,String str2){}


    @Before("aspMethod()")
    public void beforeAdvice(JoinPoint joinPoint){
        System.out.println("----dobefore()开始----");
    }

    @Before("aspMethod1(str1,str2)")
    public void beforeAdvice2(String str1,String str2) {
        System.out.println("str1 : "+str1+" : "+"str2 : "+str2);
    }

}
